<#include "../../ajaxPage.ftl" />
<!-- Modal -->
<div class="modal-dialog wide" style="width: 750px;">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title" id="myModalLabel">分配资源</h4>
        </div>
        <div class="modal-body">
            <div id="errorMessage"><#include "../../message.ftl" /></div>
            <div class="row">
                <section class="tile">
                    <div class="tile-header">
                        <h1>
                            <button type="button" class="btn btn-green" onclick="popAddOrModifyResource();"><i
                                    class="fa fa-plus"></i><span class="margin-left-5">新增资源</span></button>
                            <button type="button" class="btn btn-cyan" onclick="deleteResource();"><i
                                    class="fa fa-trash-o"></i><span class="margin-left-5">删除资源</span></button>
                        </h1>
                    </div>
                </section>
            </div>
            <form class="form-horizontal" role="form" id="search_assign_resource_table" method="post"
                  action="${absoluteContextPath}/system/authData/ajaxAssignResourceList">
                <input type="hidden" name="authId" value="${authId!''}"/>
                <input type="hidden" name="moduleId" value="${moduleId!''}"/>
                <input type="hidden" name="pageSize" value="${resourcesTable.page.pageSize}"/>
                <input type="hidden" name="currentPage" value="${resourcesTable.page.currentPage}"/>

                <div class="table-responsive" id="assignResourceTableContent">
                <#include "assignResourceTable.ftl"/>
                </div>
            </form>

        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</button>
        </div>
    </div>
</div>
<script>
    $(function () {
        $("#checkResourceIdAll").change(function () {
            if ($(this).attr("checked")) {
                $("input[name=resourceIds]").attr("checked", true);
            } else {
                $("input[name=resourceIds]").attr("checked", false);
            }
        });
        $("input[name=resourceIds]").change(function () {
            if (!$(this).attr("checked")) {
                $("#checkAll").attr("checked", false);
            }
        });
    });
</script>